package com.ruoyi.web.controller.system;

import com.github.pagehelper.PageHelper;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.BAnjuanYuanShi;
import com.ruoyi.system.service.IBAnjuanYuanShiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 94年之前案卷信息处理Controller
 * 
 * @author zzr
 * @date 2023-09-16
 */
@RestController
@RequestMapping("/system/original")
public class BAnjuanYuanShiController extends BaseController
{
    @Autowired
    private IBAnjuanYuanShiService bAnjuanYuanShiService;

    /**
     * 查询94年之前案卷信息处理列表
     */
//    //@PreAuthorize("@ss.hasPermi('system:original:list')")
    @GetMapping("/list")
    public TableDataInfo list(BAnjuanYuanShi bAnjuanYuanShi)
    {
        startPage();
        PageHelper.orderBy("ajh");
        List<BAnjuanYuanShi> list = bAnjuanYuanShiService.selectBAnjuanYuanShiList(bAnjuanYuanShi);
        return getDataTable(list);
    }

    /**
     * 导出94年之前案卷信息处理列表
     */
//    //@PreAuthorize("@ss.hasPermi('system:original:export')")
    @Log(title = "94年之前案卷信息处理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BAnjuanYuanShi bAnjuanYuanShi)
    {
        List<BAnjuanYuanShi> list = bAnjuanYuanShiService.selectBAnjuanYuanShiList(bAnjuanYuanShi);
        ExcelUtil<BAnjuanYuanShi> util = new ExcelUtil<BAnjuanYuanShi>(BAnjuanYuanShi.class);
        util.exportExcel(response, list, "94年之前案卷信息处理数据");
    }

    /**
     * 获取94年之前案卷信息处理详细信息
     */
//    //@PreAuthorize("@ss.hasPermi('system:original:query')")
    @GetMapping(value = "/{recid}")
    public AjaxResult getInfo(@PathVariable("recid") String recid)
    {
        return success(bAnjuanYuanShiService.selectBAnjuanYuanShiByRecid(recid));
    }

    /**
     * 新增94年之前案卷信息处理
     */
//    //@PreAuthorize("@ss.hasPermi('system:original:add')")
    @Log(title = "94年之前案卷信息处理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BAnjuanYuanShi bAnjuanYuanShi)
    {
        return toAjax(bAnjuanYuanShiService.insertBAnjuanYuanShi(bAnjuanYuanShi));
    }

    /**
     * 修改94年之前案卷信息处理
     */
//    //@PreAuthorize("@ss.hasPermi('system:original:edit')")
    @Log(title = "94年之前案卷信息处理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BAnjuanYuanShi bAnjuanYuanShi)
    {
        return toAjax(bAnjuanYuanShiService.updateBAnjuanYuanShi(bAnjuanYuanShi));
    }

    /**
     * 删除94年之前案卷信息处理
     */
//    //@PreAuthorize("@ss.hasPermi('system:original:remove')")
    @Log(title = "94年之前案卷信息处理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{recids}")
    public AjaxResult remove(@PathVariable String[] recids)
    {
        return toAjax(bAnjuanYuanShiService.deleteBAnjuanYuanShiByRecids(recids));
    }
}
